﻿@using Kaqaz.Common.Security
@using Xoqal.Security
@model Kaqaz.Models.Post

<div class="comments">
@foreach (var item in Model.VisibleComments) {
    <div class="comment-placeholder">
    <div class="comment-name">
        @if (!string.IsNullOrWhiteSpace(item.Website))
        {
            <a href="@(item.Website.ToLower().StartsWith("http://")? item.Website : "http://" + item.Website)">
                @item.Name
            </a>
        }
        else
        {
            @item.Name
        }
    </div>
    
    <div class="comment-content-placeholder">
        @if (Authentication.Default.IsUserInPermission(Permissions.PostManagement, Permissions.PostManagement))
        {
            <text>
            <div class="comment-email">&nbsp;-&nbsp;@item.Email</div>
            </text>
        }
    
        <div class="comment-createtime">@GlobalDateTime.ToLongDateTimeString(item.CreateTime)</div>
    
        <div class="comment-content">
            @item.Content
        </div>
    </div>
    </div>
}
</div>

@Html.Partial("CreateComment", new Kaqaz.Entities.Comment { PostId = Model.Id })
